02. Packages
Packages
ND079 C1 L3 A02 Packages
In Java, we use packages to organize and manage our Java files:
- If you are used to the concept of namespaces, packages serve essentially the same purpose in Java.
- Packages are not unlike the traditional folders that you use every day on your computer for organizing your files.
- By nesting packages and files, we can create a hierarchy that allows us to identify specific files and avoid naming conflicts.
The package
keyword will be located at the top of a Java file, typically on the first line of the file, before the imports and class name. For example:
package project.src.api
SOLUTION:
- Used to organize and manage Java files.
- Used to distinguish Java files with the same name.